package aybolit.core.objects.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 13.03.13
 * Time: 16:57
 * To change this template use File | Settings | File Templates.
 */
@Table(name = "analyzes_name", catalog = "aybolit", schema = "")
@Entity
public class AnalyzesName implements Serializable{
    private int analyzesNameId;

    @Column(name = "analyzes_name_id")
    @Id
    public int getAnalyzesNameId() {
        return analyzesNameId;
    }

    public void setAnalyzesNameId(int analyzesNameId) {
        this.analyzesNameId = analyzesNameId;
    }

    private String name;

    @Column(name = "name")
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String note;

    @Column(name = "note")
    @Basic
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    private int type;

    @Column(name = "type")
    @Basic
    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    private int status;

    @Column(name = "status")
    @Basic
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AnalyzesName that = (AnalyzesName) o;

        if (analyzesNameId != that.analyzesNameId) return false;
        if (status != that.status) return false;
        if (type != that.type) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (note != null ? !note.equals(that.note) : that.note != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = analyzesNameId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (note != null ? note.hashCode() : 0);
        result = 31 * result + type;
        result = 31 * result + status;
        return result;
    }

    private Collection<HealingAnalyzes> healingAnalyzesesByAnalyzesNameId;

    @OneToMany(mappedBy = "analyzesNameByAnalyzesNameId")
    public Collection<HealingAnalyzes> getHealingAnalyzesesByAnalyzesNameId() {
        return healingAnalyzesesByAnalyzesNameId;
    }

    public void setHealingAnalyzesesByAnalyzesNameId(Collection<HealingAnalyzes> healingAnalyzesesByAnalyzesNameId) {
        this.healingAnalyzesesByAnalyzesNameId = healingAnalyzesesByAnalyzesNameId;
    }
}
